﻿<Window
    x:Class="WpfTimelineExample.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:timeline="clr-namespace:TimelineLibrary;assembly=TimelineLibrary"
    Title="Window1"
    Height="800"
    Activated="Window_Activated"
    Width="800">

    <Grid
        x:Name="LayoutRoot"
        Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition Height="25"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="2"
                    x:Name="grdTimeLine">
                    <Grid.RowDefinitions>
                        <RowDefinition
                            Height="*" />
                        <RowDefinition
                            Height="30" />
                    </Grid.RowDefinitions>

                    <timeline:TimelineTray
                        x:Name="timeline"
                        Grid.Row="0"
                        MinDateTime="1/1/1839"
                        MaxDateTime="1/1/1930"
                        CalendarType="gregorian"
                        HorizontalAlignment="Stretch"
                        CurrentDateTime="11/01/1855" TimelineReady="timeline_TimelineReady">

                        <Grid.RowDefinitions>
                            <RowDefinition
                                Height="*" />
                            <RowDefinition
                                Height="50" />
                            <RowDefinition
                                Height="30" />
                        </Grid.RowDefinitions>

                        <timeline:TimelineBand
                            IsMainBand="True"
                            ItemSourceType="years"
                            TimelineWindowSize="20"
                            MaxEventHeight="130"
                            Margin="0,72,0,0" />

                        <timeline:TimelineBand
                            Grid.Row="1"
                            HorizontalAlignment="Stretch"
                            ItemSourceType="decades"
                            TimelineWindowSize="16"
                            MaxEventHeight="4" />

                        <timeline:TimelineToolbox
                            Grid.Row="1"
                            Margin="0,40,0,0"
                            Grid.RowSpan="2"></timeline:TimelineToolbox>
                    </timeline:TimelineTray>
                    <Button
                        Content="Change Image"
                        Grid.Row="1"
                        Height="30"
                        HorizontalAlignment="Left"
                        Margin="594,1,0,0"
                        Name="button2"
                        VerticalAlignment="Top"
                        Width="82"
                        Click="Button2Click" DataContext="{Binding ElementName=timeline, Path=SelectedTimelineEvents}" />

                    <Button
                        Content="ResetEvents"
                        Grid.Row="1"
                        Height="30"
                        HorizontalAlignment="Left"
                        Margin="684,1,0,0"
                        Name="button1"
                        VerticalAlignment="Top"
                        Width="82"
                        Click="button1_Click" DataContext="{Binding ElementName=timeline, Path=SelectedTimelineEvents}" />
                </Grid>
        <StackPanel Orientation="Horizontal" Grid.Row="0">
            <Label
                            Height="23"
                            HorizontalAlignment="Left"
                            Name="label1"
                            VerticalAlignment="Top"
                            Margin="4,10,4,0">MinDateTime</Label>
            <TextBox
                            Height="23"
                            HorizontalAlignment="Left"
                            Name="minDateTime"
                            VerticalAlignment="Top"
                            Text="{Binding Path=MinDateTime, ElementName=timeline}"
                            Margin="0,10,4,0"></TextBox>
            <Label
                            Height="23"
                            HorizontalAlignment="Left"
                            Name="label2"
                            VerticalAlignment="Top"
                            Margin="0,10,4,0">MaxDateTime</Label>
            <TextBox
                            Height="23"
                            Name="maxDateTime"
                            Text="{Binding Path=MaxDateTime, ElementName=timeline}"
                            VerticalAlignment="Top" Margin="0,10,4,0"/>
            <Label
                            Height="23"
                            HorizontalAlignment="Right"
                            Name="label3"
                            VerticalAlignment="Top"
                            Margin="0,10,4,0">CurrentDateTime</Label>
            <TextBox
                            Height="23"
                            HorizontalAlignment="Right"
                            Name="currentDateTime"
                            VerticalAlignment="Top"
                            Text="{Binding Path=CurrentDateTime, ElementName=timeline}"
                            Margin="0,10,4,0"></TextBox>
            <Label Grid.Row="0" Content="Selected" Height="28" HorizontalAlignment="Right" Margin="0,10,4,0" Name="label4" VerticalAlignment="Top" />
            <Label Grid.Row="0" Content="{Binding ElementName=timeline, Path=SelectedTimelineEvents.Count,NotifyOnSourceUpdated=True}" Height="25" HorizontalAlignment="Right" Margin="0,10,4,0" Name="selectedCount" VerticalAlignment="Top" Target="{Binding ElementName=timeline, Path=SelectedTimelineEvents}" />
        </StackPanel>
        <Slider
                            Height="23"
                            Grid.Row="1"
                            Name="slider1"
                            VerticalAlignment="Top"
                            Maximum="36500"
                            ValueChanged="slider1_ValueChanged" />
    </Grid>

</Window>
